package huawei.js2025;

import java.util.Scanner;

/**
 * 字符串划分
 */
public class Question34 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();

        if (line.length() < 5 || line.length() > 200) {
            System.out.println("0,0");
        }

        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        int sum = 0;

        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            sum += c;

            min = Math.min(min, line.charAt(i));
            max = Math.max(max, line.charAt(i));
        }

        int start = 2 * min;
        int end = 2 * max;

        int t1 = 0; int t2 = 0;
        for (int d = start; d <= end; d++) {
            if ((sum - d) % 3 == 0) {
                int targetSum = (sum - d) / 3;

                int i = 0;
                int subSum = 0;
                while (targetSum > subSum) {
                    subSum += line.charAt(i++);
                }
                if (targetSum != subSum) continue;
                t1 = i;

                i ++;
                subSum = 0;
                while (targetSum > subSum) {
                    subSum += line.charAt(i++);
                }
                if (targetSum != subSum) {
                    t1 = 0;
                    continue;
                }
                t2 = i;
                break;
            }
        }

        System.out.println(t1+","+t2);

    }
}
